<div class="calendar_picker"></div>
<!--  			
<div class="fl pl25">
	<span class="b f14">Confira os próximos eventos</span>
	<div class="pt10" id="cEvento">
		<?php if(!count($ar)):?><b>NENHUM EVENTO CADASTRADO!</b><?php endif; ?>
		<?php foreach($ar as $evento): ?>
		<a href="<?php echo url_for('@evento?id_evento='.$evento['id_evento'])?>">
		<span class="b"><?php echo $evento['dt_evento']; ?></span> - <?php echo $evento['nm_evento']?>
		</a>
		<br /><br />
		<?php endforeach; ?>
	</div>	
</div>
-->

<script type="text/javascript">
$(function(){
	var dates = <?php echo $datas; ?>;
    
    $('.calendar_picker').datepicker({
    	dateFormat: 'dd/mm/yyyy',
    	selectWeek: true,
        inline: true,
    	beforeShowDay: highlightDays,
    	onSelect: function(date){ getValor(date); }
    });
    
    function highlightDays(date)
    {
    	for (i = 0; i < dates.length; i++) {
            if (date.getMonth() == dates[i][0] - 1
            && date.getDate() == dates[i][1]
            && date.getFullYear() == dates[i][2]) {
            	return [true,"ui-state-active"];
            }
         }
         return [false, ""];
    }
    function getValor(date)
    {
    	$.get("<?php echo url_for('terapiavital/carregarEventoData'); ?>",{data:date},
    	    function(dados){
        		$("#cEvento").empty().fadeIn("slow").css("display","block").html(dados);
    		}
		);
    }
});
</script>